<?php
/*
 * @Creator: 小傲
 * @Date: 2023-04-04 11:11:23
 */

use think\migration\Migrator;

class SupplyBanner extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable 
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table  =  $this->table('supply_banner',array('engine'=>'InnoDB','collation'=>'utf8_unicode_ci'));
        $table->addColumn('title', 'string',array('limit' => 50,'comment'=>'横幅广告'))
            ->addColumn('banner_img', 'string',array('limit' => 200,'comment'=>'图片链地址')) 
            ->addColumn('link', 'string',array('limit' => 200,'comment'=>'链接地址')) 
            ->addColumn('sort', 'boolean',array('limit' => 99,'comment'=>'排序0~99'))
            ->addColumn('admin_id', 'integer',array('limit' => 11,'default'=>'1','comment'=>'管理员id'))
            ->addColumn('status', 'boolean',array('limit' => 1,'default'=>'1','comment'=>'状态'))
            ->addColumn('create_time', 'integer',array('default'=>time(),'comment'=>'创建时间'))
            ->addColumn('update_time', 'integer',array('null'=>true,'comment'=>'更新时间'))
            ->addColumn('delete_time', 'integer',array('null'=>true,'comment'=>'删除时间'))
            ->create();
    }
}
